import { defineStore } from "pinia"
import {getEntireRoles,getEntireDepartments,getEntireMenus} from "@/service/main/main"
interface IMainState {
  entireRoles: any[]
  entireDepartments: any[]
  entireMenus:any[]
}
const useMainStore = defineStore("main", {
  state: (): IMainState => ({
    entireRoles: [],
    entireDepartments: [],
    entireMenus:[]
  }),
  actions: {
    async fetchEntireDataAction() {
      const entireRoles=await getEntireRoles()
      this.entireRoles=entireRoles.data.list
      const entireDepartments=await getEntireDepartments()
      this.entireDepartments=entireDepartments.data.list
      const entiremenus=await getEntireMenus()
      this.entireMenus=entiremenus.data.list
    }
  }
})
export default useMainStore
